﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ECommerce.BLL.Order;
using ECommerce.Model.Order;
using Jzy.Core.Common.Web;

namespace ECommerce.Web.ECAdmin.Order
{
    public partial class Detail : PageDetail
    {
        private ECOrderBO Order
        {
            get
            {
                return ECOrderBO.Instance<ECOrderBO>();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            DispInfo();
        }

        private void DispInfo()
        {
            ECOrderInfo info = Order.GetInfo(this.PKID);
            EntityUtil.SetControl(pnlMain, info);

            this.OrderID.Text = info.ID.ToString();
            this.PayState.Text = ((PayState)info.PayState).ToString();
            this.OrderState.Text = ((OrderState)info.OrderState).ToString();
            this.PayMode.Text = ((PayMode)info.PayMode).ToString();

            this.litInvoiceHead.Text = ((InvoiceTarget)info.InvoiceTarget).ToString();
            this.DeliverTime.Text = info.DeliverTime.ToString("yyyy-MM-dd");
            if (info.InvoiceTarget == (int)InvoiceTarget.单位)
            {
                this.litInvoiceHead.Text += "&nbsp;(" + info.InvoiceHead + ")";
            }

            this.RecieveArea.Text = "[" + info.RecieveArea + "]";
           // this.SendArea.Text = "[" + info.SendArea + "]";
            this.DeliverPart.Text = "[" + info.DeliverPart + "]";
            this.litBigArea.Text = "[" + ((BigArea)info.BigArea).ToString() + "]";
            this.litReceiveBigArea.Text = "[" + ((BigArea)info.RecieveBigArea).ToString() + "]";

            if (info.LogisticsType == (int)LogisticType.门店自取)
            {
                tr1.Visible = true;
                tr2.Visible = false;
                tr3.Visible = false;
                tr4.Visible = false;

            }
            else
            {
                tr1.Visible = false;
                tr2.Visible = true;
                tr3.Visible = true;
                tr4.Visible = true;
            }

            rptProduct.DataSource = info.Products;
            rptProduct.DataBind();
        }
    }
}